package com.weilive.core.utils;

import java.io.BufferedReader;
import java.io.FileReader;

public class PropertiesFile extends PropertiesMap {

	public PropertiesFile(String file) {
		try {
			BufferedReader reader = new BufferedReader(new FileReader(file));
			String line;
			while ((line = reader.readLine()) != null) {
				line = line.trim();
				if (line.length() == 0 || line.startsWith("#")) {
					continue;
				}
				int pos = line.indexOf("=");
				String key = pos >= 0 ? line.substring(0, pos).trim() : line;
				String value = pos >= 0 ? line.substring(pos+1).trim() : "";
				properties.put(key, value);
			}
			reader.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
